package com.dyoung.carpool.node.greendao.core;

import java.util.Map;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.AbstractDaoSession;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.identityscope.IdentityScopeType;
import org.greenrobot.greendao.internal.DaoConfig;

import com.dyoung.carpool.node.greendao.model.CarPoolNode;
import com.dyoung.carpool.node.greendao.model.Node;
import com.dyoung.carpool.node.greendao.model.Trip;

import com.dyoung.carpool.node.greendao.core.CarPoolNodeDao;
import com.dyoung.carpool.node.greendao.core.NodeDao;
import com.dyoung.carpool.node.greendao.core.TripDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see org.greenrobot.greendao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig carPoolNodeDaoConfig;
    private final DaoConfig nodeDaoConfig;
    private final DaoConfig tripDaoConfig;

    private final CarPoolNodeDao carPoolNodeDao;
    private final NodeDao nodeDao;
    private final TripDao tripDao;

    public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        carPoolNodeDaoConfig = daoConfigMap.get(CarPoolNodeDao.class).clone();
        carPoolNodeDaoConfig.initIdentityScope(type);

        nodeDaoConfig = daoConfigMap.get(NodeDao.class).clone();
        nodeDaoConfig.initIdentityScope(type);

        tripDaoConfig = daoConfigMap.get(TripDao.class).clone();
        tripDaoConfig.initIdentityScope(type);

        carPoolNodeDao = new CarPoolNodeDao(carPoolNodeDaoConfig, this);
        nodeDao = new NodeDao(nodeDaoConfig, this);
        tripDao = new TripDao(tripDaoConfig, this);

        registerDao(CarPoolNode.class, carPoolNodeDao);
        registerDao(Node.class, nodeDao);
        registerDao(Trip.class, tripDao);
    }
    
    public void clear() {
        carPoolNodeDaoConfig.clearIdentityScope();
        nodeDaoConfig.clearIdentityScope();
        tripDaoConfig.clearIdentityScope();
    }

    public CarPoolNodeDao getCarPoolNodeDao() {
        return carPoolNodeDao;
    }

    public NodeDao getNodeDao() {
        return nodeDao;
    }

    public TripDao getTripDao() {
        return tripDao;
    }

}
